﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Esint.Common.Model;
using Esint.Common.Data;
using System.Data;

namespace Esint.Common.Data
{
    public class DataQuery:IDataQuery
    {

        #region IRootQueryObject 成员

        /// <summary>
        /// 排序字段列表
        /// </summary>
        public string OrderByString { get; set; }

        /// <summary>
        /// 主键列
        /// </summary>
        public string PrimaryKeyField { get; set; }

        /// <summary>
        /// 聚组字符串
        /// </summary>
        public string GroupByString { get; set; }

        private PageSplit _pageView;
        public PageSplit PageView
        {
            get {
                if (_pageView == null)
                    _pageView = new PageSplit();
                return _pageView;
            }
            set
            {
                _pageView = value;
               // _pageView.IsPageView = true;
            }
        }

        private List<IDataParameter> _dataParameters;
        internal List<IDataParameter> DbParameters
        {
            get
            {
                if (_dataParameters == null)
                    _dataParameters = new List<IDataParameter>();
                return _dataParameters;
            }
            set
            {
                _dataParameters = value;
            }
        }

        private List<IRootJoinTable> _joinTables;
        public List<IRootJoinTable> JoinTables
        {
            get
            {
                if (_joinTables == null)
                    _joinTables = new List<IRootJoinTable>();
                return _joinTables;
            }
            set
            {
                _joinTables = value;
            }
        }

        #endregion

        #region IBasicQueryObject 成员

        public string FieldString { get; set; }

        public string TableName { get; set; }

        public string Alias { get; set; }

        public string SQLText { get; set; }

        private List<IRootWhereParameter> _whereParameters;
        public List<IRootWhereParameter> WhereParameters
        {
            get
            {
                if (_whereParameters == null)
                    _whereParameters = new List<IRootWhereParameter>();
                return _whereParameters;
            }
            set
            {
                _whereParameters = value;
            }
        }
        #endregion

        public string ExecSQLCommandText{ get; set; }
    }
}
